package com.itheima.reggie.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.itheima.reggie.bean.Orders;
import com.itheima.reggie.common.R;
import com.itheima.reggie.dto.OrdersDto;
import com.itheima.reggie.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired
    private OrderService os;

    //page=1&pageSize=1
    @GetMapping("/userPage")
    public R userPage(Integer page ,Integer pageSize){
        try {
            IPage<OrdersDto> iPage = os.userPage(page,pageSize);
            return R.success(iPage);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error("添加失败！");
        }


    }


}
